package light.head.dao.el;

import java.util.List;

import org.springframework.stereotype.Service;

import light.head.framework.base.BaseDAO;
import light.head.model.el.TrainDataAnnex;
@Service
public class TrainDataAnnexDAO extends BaseDAO<TrainDataAnnex, Integer>{
	private final static String sql_getByUuid = "FROM TrainDataAnnex f WHERE f.sn = ? AND f.deleted = 0";
	/**
	 * 根据资料编号获取所有附件信息
	 */
	public List<TrainDataAnnex> findByTmc(Integer tmc){
		String sql = "FROM TrainDataAnnex tma WHERE tma.deleted = 0 AND tma.tdc = ?";
		return find(sql, tmc);
	}
	public TrainDataAnnex getByUuid(String uuid) {
		if (!isNotNull(uuid)) 
			return null;
		List<TrainDataAnnex> list = find(sql_getByUuid, uuid);
		if (null == list || list.size() == 0) {
			return null;
		}
		return list.get(0);
	}
}
